<?xml version="1.0" encoding="windows-1250"?>
<gxsl:stylesheet xmlns:gxsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/TransformAlias" xml:space="default">
  <gxsl:namespace-alias stylesheet-prefix="xsl" result-prefix="gxsl"/>
  <gxsl:output method="xml" encoding="windows-1250" cdata-section-elements="gxsl:comment" indent="yes"/>
  
  <gxsl:param name="cvincludepage"/>
  <gxsl:param name="cvinclude" select="$cvincludepage/.."/>
  <gxsl:param name="lang">cs</gxsl:param>
  
  <gxsl:template match="/">
    <xsl:stylesheet version="1.0">
      <xsl:output method="html" indent="no" encoding="windows-1250"/>
      <gxsl:apply-templates select="$cvinclude"/>        
    </xsl:stylesheet>        
  </gxsl:template>

  <gxsl:template match="CVInclude">
    <gxsl:variable name="dict" select="document('dictionary.xml')/Translation"/>

      <xsl:template match="DPPrint">

      <p>
      <font size="+1"><b>
        <gxsl:choose>
          <gxsl:when test="CVITitles/CVITitle">
            <gxsl:value-of select="CVITitles/CVITitle[@id_cttype='listtitle']/Title"/>
          </gxsl:when>
          <gxsl:otherwise><gxsl:value-of select="@concept"/> List</gxsl:otherwise>
        </gxsl:choose>
        
      </b></font><br/>
      <xsl:text disable-output-escaping="yes">
      <gxsl:if test="CVITitles/CVITitle">      
        <gxsl:value-of select="CVITitles/CVITitle[@id_cttype='listtitle']/Descr"/>
      </gxsl:if>
      </xsl:text>
      </p>
<!--
      <xsl:apply-templates select="DPFilter"/>
-->
      <br/>

      <xsl:choose>
        <xsl:when test="@filterfirst=1">
          <gxsl:value-of select="$dict/Text[@tid='filter_first']/Value[@lang=$lang]"/><br/><br/>
        </xsl:when> 
        <xsl:otherwise>

          <table>
          <tr>
    
            <xsl:choose>
              <xsl:when test="@orderkey='no'">
                <th>#&#160;</th>
              </xsl:when> 
              <xsl:otherwise>
                <th><a href="?dp={{/DPOutput/@dataport}}&amp;{@concept}.orderby=">#</a>&#160;</th>
              </xsl:otherwise> 
            </xsl:choose>
    
            <gxsl:for-each select="CVIProperties/CVIProperty[PropGroup/@select='1' and @onlist='show']">
    
            <gxsl:choose>
    
    
            <gxsl:when test="not(RefProp)">
    
              <xsl:choose>
                <xsl:when test="@orderby='{@name}'">
                  <xsl:choose>
                    <xsl:when test="@order='desc'">
                      <th class="ordered"><a href="?dp={{/DPOutput/@dataport}}&amp;{../../@concept}.orderby={@name}&amp;{../../@concept}.order=asc"><xsl:attribute name="title"><gxsl:value-of select="Descr"/></xsl:attribute><gxsl:value-of select="Title"/></a>*</th>      
                    </xsl:when> 
                    <xsl:otherwise>
                      <th class="ordered"><a href="?dp={{/DPOutput/@dataport}}&amp;{../../@concept}.orderby={@name}&amp;{../../@concept}.order=desc"><xsl:attribute name="title"><gxsl:value-of select="Descr"/></xsl:attribute><gxsl:value-of select="Title"/></a></th>      
                    </xsl:otherwise> 
                  </xsl:choose>
                </xsl:when> 
                <xsl:otherwise>
                  <th><a href="?dp={{/DPOutput/@dataport}}&amp;{../../@concept}.orderby={@name}"><xsl:attribute name="title"><gxsl:value-of select="Descr"/></xsl:attribute><gxsl:value-of select="Title"/></a></th>      
                </xsl:otherwise> 
              </xsl:choose>
    
            </gxsl:when>
            <gxsl:otherwise>
    
            <gxsl:for-each select="RefProp">
              <gxsl:variable name="rptitle">
                <gxsl:choose>
                  <gxsl:when test="last()>1"><gxsl:value-of select="../Title"/>: <gxsl:value-of select="Title"/></gxsl:when>
                  <gxsl:otherwise><gxsl:value-of select="../Title"/></gxsl:otherwise>
                </gxsl:choose>
              </gxsl:variable>                      
              <gxsl:variable name="rpdescr">
                <gxsl:choose>
                  <gxsl:when test="last()>1"><gxsl:value-of select="Descr"/></gxsl:when>
                  <gxsl:otherwise><gxsl:value-of select="../Descr"/></gxsl:otherwise>
                </gxsl:choose>
              </gxsl:variable>                      
                              
              <xsl:choose>
                <xsl:when test="@orderby='{../@nickname}.{@refconcept}/{@code}'">
                  <xsl:choose>
                    <xsl:when test="@order='desc'">
                      <th class="ordered"><a href="?dp={{/DPOutput/@dataport}}&amp;{../../../@concept}.orderby={../@nickname}.{@refconcept}/{@code}&amp;{../../../@concept}.order=asc"><xsl:attribute name="title"><gxsl:value-of select="$rpdescr"/></xsl:attribute><gxsl:value-of select="$rptitle"/></a>*</th>      
                    </xsl:when> 
                    <xsl:otherwise>
                      <th class="ordered"><a href="?dp={{/DPOutput/@dataport}}&amp;{../../../@concept}.orderby={../@nickname}.{@refconcept}/{@code}&amp;{../../../@concept}.order=desc"><xsl:attribute name="title"><gxsl:value-of select="$rpdescr"/></xsl:attribute><gxsl:value-of select="$rptitle"/></a></th>      
                    </xsl:otherwise> 
                  </xsl:choose>
                </xsl:when> 
                <xsl:otherwise>
                  <th><a href="?dp={{/DPOutput/@dataport}}&amp;{../../../@concept}.orderby={../@nickname}.{@refconcept}/{@code}"><xsl:attribute name="title"><gxsl:value-of select="$rpdescr"/></xsl:attribute><gxsl:value-of select="$rptitle"/></a></th>      
                </xsl:otherwise> 
              </xsl:choose>
    
            </gxsl:for-each>
    
            </gxsl:otherwise> 
            </gxsl:choose>
    
    
            </gxsl:for-each>
        
          </tr>
    
          <gxsl:choose>
            <gxsl:when test="@treelist='1' and name(..)='CView'">
              <xsl:apply-templates select="{ancestor::CView/@name}/{@conceptcoll}/{@concept}"> 
                <xsl:with-param name="root" select="."/>
              </xsl:apply-templates>
            </gxsl:when>
            <gxsl:otherwise>
              <xsl:apply-templates select="{@conceptcoll}/{@concept}"> 
                <xsl:with-param name="root" select="."/>
              </xsl:apply-templates>
            </gxsl:otherwise>      
          </gxsl:choose>        
    
          </table>

        </xsl:otherwise> 
      </xsl:choose>      

      <xsl:apply-templates select="DPPage"/> 

      </xsl:template>


      <xsl:template match="{@concept}"> 
        <xsl:param name="root"></xsl:param>
        
        <xsl:variable name="rowclass">
          <gxsl:choose>
            <gxsl:when test="@treelist='1' and name(..)='CView'">row1</gxsl:when>
            <gxsl:otherwise>
              <xsl:choose>
                <xsl:when test="position() mod 2 =1">row1</xsl:when> 
                <xsl:otherwise>row2</xsl:otherwise> 
              </xsl:choose>
            </gxsl:otherwise>
          </gxsl:choose>
        </xsl:variable>
        <tr class="{{$rowclass}}">
        <td class="row">
          <xsl:value-of select="$root/DPPage/@at + position() - 1"/>.&#160;
        </td>        

        <gxsl:for-each select="CVIProperties/CVIProperty[PropGroup/@select='1' and @onlist='show']">
          <gxsl:variable name="valsrcprm">
            <gxsl:choose>
              <gxsl:when test="@attr='1'">@<gxsl:value-of select="@nicknamelow"/></gxsl:when>
              <gxsl:otherwise><gxsl:value-of select="@nickname"/></gxsl:otherwise>
            </gxsl:choose>
          </gxsl:variable>
    
        <gxsl:choose>
          <gxsl:when test="@type='url'">
            <td class="row"> 
              <xsl:value-of select="substr-before(substr-after({$valsrcprm},'&quot;>'),'&lt;/a>)"/>  
            </td>
          </gxsl:when>
          <gxsl:when test="@type='boolean'">
            <td class="row"> 
              <xsl:choose>
                <xsl:when test="{$valsrcprm}='1'">
                  <xsl:text><gxsl:value-of select="translate($dict/Text[@tid='Yes']/Value[@lang=$lang],'ABCDEFGHIJKLMNOPQRSTUVWXYZ','abcdefghijklmnopqrstuvwxyz')"/></xsl:text>
                </xsl:when>
                <xsl:when test="{$valsrcprm}='0'">
                  <xsl:text><gxsl:value-of select="translate($dict/Text[@tid='No']/Value[@lang=$lang],'ABCDEFGHIJKLMNOPQRSTUVWXYZ','abcdefghijklmnopqrstuvwxyz')"/></xsl:text>
                </xsl:when>
                <xsl:otherwise>
                  <xsl:text>&#160;</xsl:text>
                </xsl:otherwise>
              </xsl:choose>                              
            </td>
          </gxsl:when>
          <gxsl:when test="@type='boolean_txt'">
            <td class="row"> 
              <xsl:choose>
                <xsl:when test="{$valsrcprm}='true'">
                  <xsl:text><gxsl:value-of select="translate($dict/Text[@tid='Yes']/Value[@lang=$lang],'ABCDEFGHIJKLMNOPQRSTUVWXYZ','abcdefghijklmnopqrstuvwxyz')"/></xsl:text>
                </xsl:when>
                <xsl:when test="{$valsrcprm}='false'">
                  <xsl:text><gxsl:value-of select="translate($dict/Text[@tid='No']/Value[@lang=$lang],'ABCDEFGHIJKLMNOPQRSTUVWXYZ','abcdefghijklmnopqrstuvwxyz')"/></xsl:text>
                </xsl:when>
                <xsl:otherwise>
                  <xsl:text>&#160;</xsl:text>
                </xsl:otherwise>
              </xsl:choose>
            </td>
          </gxsl:when>                   
          <gxsl:when test="not(RefProp)">
            <td class="row">
              <xsl:value-of select="{$valsrcprm}"/>
            </td>
          </gxsl:when>
          <gxsl:when test="@fetchtype='external' and @ref and @ref!='' and @extwork and @extwork!=''">
            <gxsl:choose>
              <gxsl:when test="not(RefProp)">
                <td class="row">   
                  <xsl:value-of select="{$valsrcprm}"/>
                </td>
              </gxsl:when>
              <gxsl:otherwise>
                <gxsl:for-each select="RefProp">
                  <td class="row">   
                    <gxsl:variable name="valsrcrefprm">
                      <gxsl:choose>
                        <gxsl:when test="@attr='1'">@<gxsl:value-of select="@nicknamelow"/></gxsl:when>
                        <gxsl:otherwise><gxsl:value-of select="@nickname"/></gxsl:otherwise>
                      </gxsl:choose>
                    </gxsl:variable>
                    <xsl:value-of select="{$valsrcrefprm}"/>
                  </td>
                </gxsl:for-each>
              </gxsl:otherwise>
            </gxsl:choose>                    
          </gxsl:when>
          <gxsl:otherwise>
            <gxsl:for-each select="RefProp">
              <td class="row">   
              <gxsl:variable name="valsrcrefprm">
                <gxsl:choose>
                  <gxsl:when test="@attr='1'">@<gxsl:value-of select="@nicknamelow"/></gxsl:when>
                  <gxsl:otherwise><gxsl:value-of select="@nickname"/></gxsl:otherwise>
                </gxsl:choose>
              </gxsl:variable>
              <xsl:value-of select="{$valsrcrefprm}"/>
              </td>
            </gxsl:for-each>
          </gxsl:otherwise> 
        </gxsl:choose>




        </gxsl:for-each>

        </tr>
        
      <gxsl:if test="@treelist='1' and name(..)='CView'">
        <gxsl:variable name="cols"><gxsl:value-of select="count(CVIProperties/CVIProperty[PropGroup/@select='1' and @onlist='show' and not(RefProp)])+count(CVIProperties/CVIProperty[PropGroup/@select='1' and @onlist='show']/RefProp)"/></gxsl:variable>
        <gxsl:for-each select="CVIRels/CVIRel/CVInclude[@virtual='0' and @treelist='1']">
          <xsl:if test="count({@nickcoll}/{@nickname})>0">          
          <tr class="row2">
          <td class="row">&#160;</td>
          <td class="row" colspan="{$cols}">

          <gxsl:choose>
            <gxsl:when test="not(@hasflap) or @hasflap!='0'">
              <a>
                <xsl:attribute name="href">?dp=list<gxsl:value-of select="@id_cvinclude"/><gxsl:for-each select="../../Keys/Binding">&amp;<gxsl:value-of select="@property"/>=<xsl:value-of select="@{@propertylow}"/></gxsl:for-each></xsl:attribute>
                <xsl:attribute name="title"><gxsl:for-each select="CVIProperties/CVIProperty[PropGroup/@select='1' and @onlist='show']"><gxsl:value-of select="Title"/><gxsl:if test="position()!=last()">, </gxsl:if></gxsl:for-each></xsl:attribute>
                <i>- <gxsl:value-of select="CVITitles/CVITitle[@id_cttype='flaptitle']/Title"/></i>
              </a>
            </gxsl:when>
            <gxsl:otherwise>
              <i>- <gxsl:value-of select="CVITitles/CVITitle[@id_cttype='flaptitle']/Title"/></i>
            </gxsl:otherwise>
          </gxsl:choose>
          <br/>
          
          <table>
            <xsl:for-each select="{@nickcoll}/{@nickname}">
            <tr>
              <td>&#160;&#160;&#160;</td>
              <gxsl:for-each select="CVIProperties/CVIProperty[PropGroup/@select='1' and @onlist='show']">
                <td class="row">   
                <gxsl:choose>
                  <gxsl:when test="@attr='1'">
                    <xsl:value-of select="@{@nicknamelow}"/>
                  </gxsl:when>
                  <gxsl:otherwise>
                    <xsl:value-of select="{@nickname}"/>
                  </gxsl:otherwise>
                </gxsl:choose>
                </td>
              </gxsl:for-each>       
            </tr>
            </xsl:for-each>
          </table>
          </td>
          </tr>
          </xsl:if>
          
        </gxsl:for-each>       
      </gxsl:if>        

      </xsl:template>



  <xsl:template match="DPPage">
    <xsl:if test="@prev or @next">
      <xsl:if test="@prev">
        <a href="?dp={{/DPOutput/@dataport}}&amp;{{@doc}}.start=1">
          <gxsl:value-of select="$dict/Text[@tid='first']/Value[@lang=$lang]"/>
        </a>
      </xsl:if>
      <xsl:if test="not(@prev)">
        <b><gxsl:value-of select="$dict/Text[@tid='first']/Value[@lang=$lang]"/></b>
      </xsl:if>
      |
      <xsl:apply-templates select="Link"/>

      <xsl:if test="@next">
        <a href="?dp={{/DPOutput/@dataport}}&amp;{{@doc}}.start={{@last}}">
          <gxsl:value-of select="$dict/Text[@tid='last']/Value[@lang=$lang]"/>
        </a>
      </xsl:if>
      <xsl:if test="not(@next)">
        <b><gxsl:value-of select="$dict/Text[@tid='last']/Value[@lang=$lang]"/></b>
      </xsl:if>
      <div><gxsl:value-of select="$dict/Text[@tid='total']/Value[@lang=$lang]"/><xsl:text>&#160;</xsl:text><xsl:value-of select="@total"/><xsl:text>&#160;</xsl:text><gxsl:value-of select="$dict/Text[@tid='records']/Value[@lang=$lang]"/>.</div>

    </xsl:if>
  </xsl:template>


  <xsl:template match="Link">
    <xsl:if test="@here">
      <b><xsl:value-of select="@upto"/></b>
    </xsl:if>
    <xsl:if test="not(@here)">
      <a href="?dp={{/DPOutput/@dataport}}&amp;{{../@doc}}.start={{@at}}">
        <xsl:choose>
          <xsl:when test="@big='yes'">
            <b><xsl:value-of select="@upto"/></b>
          </xsl:when> 
          <xsl:otherwise>
            <xsl:value-of select="@upto"/>
          </xsl:otherwise> 
        </xsl:choose>
      </a>
    </xsl:if>
    |
  </xsl:template>


  <xsl:template match="DPFilter">

      <script language="JavaScript" type="text/javascript" src="{{/DPOutput/@cpath}}/sta/{{/DPOutput/@repository}}/fnc/mambo.js"/>
      <script language="JavaScript" type="text/javascript">
        <xsl:comment>
          <![CDATA[
            function checkfilter()
            {
              var form = document.forms.filter; ]]> 
              <gxsl:for-each select="CVIProperties/CVIProperty[@onfilter='show']">         
                <gxsl:choose>
                  <gxsl:when test="RefProp">
                    <gxsl:for-each select="RefProp"> 

                      <gxsl:choose>
                        <gxsl:when test="@type='int'">
                          if (!valInt(form.<gxsl:value-of select="@formcode"/>,"<gxsl:value-of select="Title"/>")) return false;
                        </gxsl:when>
                        <gxsl:when test="@type='float'">
                          if (!valFloat(form.<gxsl:value-of select="@formcode"/>,"<gxsl:value-of select="Title"/>")) return false;
                        </gxsl:when>
                        <gxsl:when test="@type='date'">
                          if (!valDate(form.<gxsl:value-of select="@formcode"/>_from,"<gxsl:value-of select="Title"/>","ISO")) return false;
                          if (!valDate(form.<gxsl:value-of select="@formcode"/>_to,"<gxsl:value-of select="Title"/>","ISO")) return false;
                        </gxsl:when>
                        <gxsl:when test="@type='datetime'">
                          if (!valDate(form.<gxsl:value-of select="@formcode"/>_from,"<gxsl:value-of select="Title"/>","ISOHms")) return false;
                          if (!valDate(form.<gxsl:value-of select="@formcode"/>_to,"<gxsl:value-of select="Title"/>","ISOHms")) return false;
                        </gxsl:when>
                        <gxsl:when test="@type='timestamp'">
                          if (!valDate(form.<gxsl:value-of select="@formcode"/>_from,"<gxsl:value-of select="Title"/>","ISOHms")) return false;
                          if (!valDate(form.<gxsl:value-of select="@formcode"/>_to,"<gxsl:value-of select="Title"/>","ISOHms")) return false;
                        </gxsl:when>
                      </gxsl:choose>
                    </gxsl:for-each>
                  </gxsl:when>
                  <gxsl:otherwise>

                      <gxsl:choose>
                        <gxsl:when test="@type='int'">
                          if (!valInt(form.<gxsl:value-of select="@formcode"/>,"<gxsl:value-of select="Title"/>")) return false;
                        </gxsl:when>
                        <gxsl:when test="@type='float'">
                          if (!valFloat(form.<gxsl:value-of select="@formcode"/>,"<gxsl:value-of select="Title"/>")) return false;
                        </gxsl:when>
                        <gxsl:when test="@type='date'">
                          if (!valDate(form.<gxsl:value-of select="@formcode"/>_from,"<gxsl:value-of select="Title"/>","ISO")) return false;
                          if (!valDate(form.<gxsl:value-of select="@formcode"/>_to,"<gxsl:value-of select="Title"/>","ISO")) return false;
                        </gxsl:when>
                        <gxsl:when test="@type='datetime'">
                          if (!valDate(form.<gxsl:value-of select="@formcode"/>_from,"<gxsl:value-of select="Title"/>","ISOHms")) return false;
                          if (!valDate(form.<gxsl:value-of select="@formcode"/>_to,"<gxsl:value-of select="Title"/>","ISOHms")) return false;
                        </gxsl:when>
                        <gxsl:when test="@type='timestamp'">
                          if (!valDate(form.<gxsl:value-of select="@formcode"/>_from,"<gxsl:value-of select="Title"/>","ISOHms")) return false;
                          if (!valDate(form.<gxsl:value-of select="@formcode"/>_to,"<gxsl:value-of select="Title"/>","ISOHms")) return false;
                        </gxsl:when>
                      </gxsl:choose>
                  </gxsl:otherwise>
                </gxsl:choose>
              </gxsl:for-each>

          <![CDATA[

              return true;
            }


            function setAstra(elem)
            {
            
                    //var str=elem.value;
                    //str=delChar(str,"%&;=");
                    //if (str.charAt(str.length-1) != "*" && str.length > 0)
                    //{
                    //       str+="*";
                    //}
                    //elem.value=str;
            }
            
            function delChar(s,del)
            {
                    var delka=s.length;
                    var pom="";
                    var i=0;
            
                    while(i<delka)
                    {
                            if(del.indexOf(s.charAt(i)) == -1)
                            {
                                    pom += s.charAt(i);
                            }
                    i++;
                    }
                    return pom;
            }
          ]]>
        //</xsl:comment>
      </script>

    <gxsl:if test="CVIProperties/CVIProperty[@onfilter='show']">

    <table border="0" cellpadding="2" cellspacing="0" width="100%">
    <form action="?" method="get" name="filter" onsubmit="return checkfilter()">
    <tr><td>
      <input type="hidden" name="dp" value="{{/DPOutput/@dataport}}"/>
        <input type="hidden" name="setfilter" value="yes"/>
        <input type="hidden" name="{@concept}.filterfirst" value="0"/>    

        <input type="submit" class="input_filter">
          <xsl:attribute name="value"><gxsl:value-of select="$dict/Text[@tid='set_filter']/Value[@lang=$lang]"/></xsl:attribute>&#160;
        </input>

        </td>
        </tr>
        <tr>
        <td>
        <font size="-2">      

        <gxsl:variable name="propprefix">
          <gxsl:choose>
            <gxsl:when test="@treelist='1' and name(..)='CView'">/<gxsl:value-of select="@concept"/>/</gxsl:when>
            <gxsl:otherwise></gxsl:otherwise>
          </gxsl:choose>
        </gxsl:variable>
        
        <gxsl:for-each select="CVIProperties/CVIProperty[@onfilter='show']">

        <gxsl:choose>
        <gxsl:when test="not(RefProp)">

            <gxsl:choose>
              <gxsl:when test="@type='boolean'">
                <nobr><gxsl:value-of select="Title"/>&#160;<select size="1" name="{@formcode}" class="input_filter">
                  <option value="">- - - <gxsl:value-of select="$dict/Text[@tid='all']/Value[@lang=$lang]"/>- - -</option>
                  <option value="1">
                    <xsl:if test="child::node()[@property='{$propprefix}{@name}']/@default='1'">
                      <xsl:attribute name="selected">yes</xsl:attribute>
                    </xsl:if>
                    <gxsl:value-of select="$dict/Text[@tid='Yes']/Value[@lang=$lang]"/>
                  </option>
                  <option value="0">
                    <xsl:if test="child::node()[@property='{$propprefix}{@name}']/@default='0'">
                      <xsl:attribute name="selected">yes</xsl:attribute>
                    </xsl:if>
                    <gxsl:value-of select="$dict/Text[@tid='No']/Value[@lang=$lang]"/>
                  </option>
                </select>&#160;&#160;&#160;</nobr>
              </gxsl:when> 
              <gxsl:when test="@type='boolean_txt'">
                <nobr><gxsl:value-of select="Title"/>&#160;<select size="1" name="{@formcode}" class="input_filter">
                  <option value="">- - - <gxsl:value-of select="$dict/Text[@tid='all']/Value[@lang=$lang]"/>- - -</option>
                  <option value="true">
                    <xsl:if test="child::node()[@property='{$propprefix}{@name}']/@default='true'">
                      <xsl:attribute name="selected">yes</xsl:attribute>
                    </xsl:if>
                    <gxsl:value-of select="$dict/Text[@tid='Yes']/Value[@lang=$lang]"/>
                  </option>
                  <option value="false">
                    <xsl:if test="child::node()[@property='{$propprefix}{@name}']/@default='false'">
                      <xsl:attribute name="selected">yes</xsl:attribute>
                    </xsl:if>
                    <gxsl:value-of select="$dict/Text[@tid='No']/Value[@lang=$lang]"/>
                  </option>
                </select>&#160;&#160;&#160;</nobr>
              </gxsl:when>                            
              <gxsl:when test="@type='date' or @type='datetime' or @type='timestamp'">
                <xsl:variable name="fnode" select="child::node()[@nick='{$propprefix}{@name}_from']"/>
                <xsl:variable name="fval">
                  <xsl:choose>
                    <xsl:when test="name($fnode)='IsNull'">!</xsl:when>
                    <xsl:otherwise><xsl:value-of select="$fnode/@default"/></xsl:otherwise>
                  </xsl:choose>
                </xsl:variable>
                <nobr><gxsl:value-of select="Title"/> (<gxsl:value-of select="$dict/Text[@tid='from-to']/Value[@lang=$lang]"/>)&#160;<input type="text" name="{@formcode}_from" value="{{$fval}}" size="8" class="input_filter" onfocus="setCurrentDate(this)"/><input type="text" name="{@formcode}_to" value="{{child::node()[@nick='{$propprefix}{@name}_to']/@default}}" size="8" class="input_filter" onfocus="setCurrentDate(this)"/>&#160;&#160;&#160;</nobr> 
              </gxsl:when> 
              <gxsl:when test="@type='int' or @type='float'">
                <xsl:variable name="fnode" select="child::node()[@property='{$propprefix}{@name}']"/>
                <xsl:variable name="fval">
                  <xsl:choose>
                    <xsl:when test="name($fnode)='IsNull'">!</xsl:when>
                    <xsl:otherwise><xsl:value-of select="$fnode/@default"/></xsl:otherwise>
                  </xsl:choose>
                </xsl:variable>
                <nobr><gxsl:value-of select="Title"/>&#160;<input type="text" name="{@formcode}" value="{{$fval}}" size="8" class="input_filter"/>&#160;&#160;&#160;</nobr>
              </gxsl:when> 
              <gxsl:otherwise>
                <gxsl:variable name="len">
                  <gxsl:choose>
                    <gxsl:when test="number(@len)&gt;15">15</gxsl:when>
                    <gxsl:when test="number(@len)&gt;5 and number(@len)&lt;=15"><gxsl:value-of select="@len"/></gxsl:when>
                    <gxsl:otherwise>5</gxsl:otherwise>
                  </gxsl:choose>
                </gxsl:variable>
                <xsl:variable name="fnode" select="child::node()[@property='{$propprefix}{@name}']"/>
                <xsl:variable name="fval">
                  <xsl:choose>
                    <xsl:when test="name($fnode)='IsNull'">!</xsl:when>
                    <xsl:otherwise><xsl:value-of select="$fnode/@default"/></xsl:otherwise>
                  </xsl:choose>
                </xsl:variable>
                <nobr><gxsl:value-of select="Title"/>&#160;<input type="text" name="{@formcode}" value="{{$fval}}" size="{$len}" class="input_filter" onChange="setAstra(this)"/>&#160;&#160;&#160;</nobr>
              </gxsl:otherwise> 
            </gxsl:choose>

        </gxsl:when>
        <gxsl:when test="@ref and @ref!='' and @fetchtype='direct'">

                <nobr><gxsl:value-of select="Title"/>&#160;<select size="1" name="{@formcode}" class="input_filter">
                  <option value="">- - - <gxsl:value-of select="$dict/Text[@tid='all']/Value[@lang=$lang]"/>- - -</option>
                  <xsl:for-each select="../Opts/{@refconceptcoll}/{@refconcept}">
                    <option value="{{@{@refproplow}}}">
                      <xsl:if test="@{@refproplow}=../../../DPFilter/child::node()[@property='{$propprefix}{@name}']/@default">
                        <xsl:attribute name="selected">yes</xsl:attribute>
                      </xsl:if>
                      <gxsl:choose>
                        <gxsl:when test="RefProp">
                          <gxsl:for-each select="RefProp">
                            <gxsl:choose>
                              <gxsl:when test="@attr='1'">
                                <xsl:value-of select="@{@lowcode}"/>
                              </gxsl:when>
                              <gxsl:otherwise>
                                <xsl:value-of select="{@code}"/>
                              </gxsl:otherwise>
                            </gxsl:choose>
                          </gxsl:for-each>
                        </gxsl:when>
                        <gxsl:otherwise>
                          <xsl:value-of select="@{@refproplow}"/>
                        </gxsl:otherwise>
                      </gxsl:choose>
                    </option>
                  </xsl:for-each>
                </select>&#160;&#160;&#160;</nobr>

        </gxsl:when>
        <gxsl:otherwise>

        <gxsl:for-each select="RefProp">

            <gxsl:choose>
              <gxsl:when test="@type='date' or @type='datetime' or @type='timestamp'">
                <xsl:variable name="fnode" select="child::node()[@nick='{../@nickname}.{@refconcept}/{@code}_from']"/>
                <xsl:variable name="fval">
                  <xsl:choose>
                    <xsl:when test="name($fnode)='IsNull'">!</xsl:when>
                    <xsl:otherwise><xsl:value-of select="$fnode/@default"/></xsl:otherwise>
                  </xsl:choose>
                </xsl:variable>
                <nobr><gxsl:value-of select="Title"/> (<gxsl:value-of select="$dict/Text[@tid='from-to']/Value[@lang=$lang]"/>)&#160;<input type="text" name="{@formcode}_from" value="{{$fval}}" size="8" class="input_filter" onfocus="setCurrentDate(this)"/><input type="text" name="{@formcode}_to" value="{{child::node()[@nick='{../@nickname}.{@refconcept}/{@code}_to']/@default}}" size="8" class="input_filter" onfocus="setCurrentDate(this)"/>&#160;&#160;&#160;</nobr>
              </gxsl:when> 
              <gxsl:when test="@type='int' or @type='float'">
                <xsl:variable name="fnode" select="child::node()[@property='{../@nickname}.{@refconcept}/{@code}']"/>
                <xsl:variable name="fval">
                  <xsl:choose>
                    <xsl:when test="name($fnode)='IsNull'">!</xsl:when>
                    <xsl:otherwise><xsl:value-of select="$fnode/@default"/></xsl:otherwise>
                  </xsl:choose>
                </xsl:variable>
                <nobr><gxsl:value-of select="Title"/>&#160;<input type="text" name="{@formcode}" value="{{$fval}}" size="8" class="input_filter"/>&#160;&#160;&#160;</nobr>
              </gxsl:when> 
              <gxsl:otherwise>
                <gxsl:variable name="len">
                  <gxsl:choose>
                    <gxsl:when test="number(@len)&gt;15">15</gxsl:when>
                    <gxsl:when test="number(@len)&gt;5 and number(@len)&lt;=15"><gxsl:value-of select="@len"/></gxsl:when>
                    <gxsl:otherwise>5</gxsl:otherwise>
                  </gxsl:choose>
                </gxsl:variable>
                <xsl:variable name="fnode" select="child::node()[@property='{../@nickname}.{@refconcept}/{@code}']"/>
                <xsl:variable name="fval">
                  <xsl:choose>
                    <xsl:when test="name($fnode)='IsNull'">!</xsl:when>
                    <xsl:otherwise><xsl:value-of select="$fnode/@default"/></xsl:otherwise>
                  </xsl:choose>
                </xsl:variable>
                <nobr><gxsl:value-of select="Title"/>&#160;<input type="text" name="{@formcode}" value="{{$fval}}" size="{$len}" class="input_filter" onChange="setAstra(this)"/>&#160;&#160;&#160;</nobr>
              </gxsl:otherwise> 
            </gxsl:choose>

        </gxsl:for-each>

        </gxsl:otherwise> 
        </gxsl:choose>

        </gxsl:for-each>

      </font>
      </td>
      </tr>        
      </form>
      </table>
      </gxsl:if>

    </xsl:template>

    <xsl:template name="title"><gxsl:value-of select="ancestor::CView/CVTitles/CVTitle/Title"/></xsl:template>
  
    </gxsl:template>
        
</gxsl:stylesheet>
